#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QColorDialog>
#include<QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
//    QColorDialog* dialog = new QColorDialog(this);
//    dialog->exec();
//    delete dialog;

    QColor color = QColorDialog::getColor(QColor(0, 255, 0), this, "对话框标题");
    qDebug() << color;

    QString style = "background-color: rgb(" + QString::number(color.red()) + "," + QString::number(color.green())
            + ", " + QString::number(color.blue()) + ");";
    this->setStyleSheet(style);
}
